R markdown

This is the syntax that we’ve been using in the labs thus far. It is much easier to provide plain text narration, but it is a bit more challenging to analyze

library(diffloop)
library(tidyverse)
library(plotly)

However, note that the chunk options are the same–

df <- data.frame(x = rnorm(100), y = 0)
df <- df %>% mutate(z = x^2)
p <- ggplot(df, aes(x=x, y=y, colour=z)) + geom_point() + 
  scale_color_gradientn(colors = c("dodgerblue", "firebrick", "black")) +
  theme_bw()

ggplotly(p)

Figure 1; an example of plotly